<template>
  <div class="app-container">
    <el-card class="box-card">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" >
        <el-form-item label="姓名" prop="username">
          <el-input
            v-model="queryParams.username"
            placeholder="请输入姓名"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!--      <el-form-item label="部职别" prop="departmentTitle">
                <el-input
                  v-model="queryParams.departmentTitle"
                  placeholder="请输入部职别"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="出生日期" prop="birth">
                <el-input
                  v-model="queryParams.birth"
                  placeholder="请输入出生日期"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->


        <!--      <el-form-item label="证件编号" prop="certificateId">
                <el-input
                  v-model="queryParams.certificateId"
                  placeholder="请输入证件编号"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="年龄" prop="age">
                <el-input
                  v-model="queryParams.age"
                  placeholder="请输入年龄"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="部门" prop="deptid">
                <el-input
                  v-model="queryParams.deptid"
                  placeholder="请输入部门"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <el-form-item label="身份证号" prop="idNumber">
          <el-input
            v-model="queryParams.idNumber"
            placeholder="请输入身份证号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!--      <el-form-item label="手机号1" prop="phoneOne">
                <el-input
                  v-model="queryParams.phoneOne"
                  placeholder="请输入手机号1"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="手机号2" prop="phoneSecond">
                <el-input
                  v-model="queryParams.phoneSecond"
                  placeholder="请输入手机号2"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="籍贯" prop="nativePlace">
                <el-input
                  v-model="queryParams.nativePlace"
                  placeholder="请输入籍贯"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="出生地" prop="birthplace">
                <el-input
                  v-model="queryParams.birthplace"
                  placeholder="请输入出生地"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="民族" prop="nation">
                <el-input
                  v-model="queryParams.nation"
                  placeholder="请输入民族"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="最高学历" prop="highestEducation">
                <el-input
                  v-model="queryParams.highestEducation"
                  placeholder="请输入最高学历"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="最高学位" prop="highestDegree">
                <el-input
                  v-model="queryParams.highestDegree"
                  placeholder="请输入最高学位"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="毕业学校" prop="graduationSchool">
                <el-input
                  v-model="queryParams.graduationSchool"
                  placeholder="请输入毕业学校"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="专业" prop="major">
                <el-input
                  v-model="queryParams.major"
                  placeholder="请输入专业"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <!--      <el-form-item label="人员类别" prop="personnelCategory">
                <el-input
                  v-model="queryParams.personnelCategory"
                  placeholder="请输入人员类别"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="政治面貌" prop="politics">
                <el-input
                  v-model="queryParams.politics"
                  placeholder="请输入政治面貌"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="入党" prop="partyTime">
                <el-date-picker clearable
                                v-model="queryParams.partyTime"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择入党">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="参加工作时间" prop="workingTime">
                <el-date-picker clearable
                                v-model="queryParams.workingTime"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择参加工作时间">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="入伍时间" prop="militaryTime">
                <el-date-picker clearable
                                v-model="queryParams.militaryTime"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择入伍时间">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="JX" prop="baseRank">
                <el-input
                  v-model="queryParams.baseRank"
                  placeholder="请输入JX"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="用户ID" prop="userId">
                <el-input
                  v-model="queryParams.userId"
                  placeholder="请输入用户ID"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="部门ID" prop="deptId">
                <el-input
                  v-model="queryParams.deptId"
                  placeholder="请输入部门ID"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <el-form-item label="科目" prop="subject">
          <el-input
            v-model="queryParams.subject"
            placeholder="请输入科目"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!--      <el-form-item label="换算成绩" prop="conversionGrade">
                <el-input
                  v-model="queryParams.conversionGrade"
                  placeholder="请输入换算成绩"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->

        <!--      <el-form-item label="训练时间" prop="practiceTime">
                <el-date-picker clearable
                                v-model="queryParams.practiceTime"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择训练时间">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="身高" prop="height">
                <el-input
                  v-model="queryParams.height"
                  placeholder="请输入身高"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="体重" prop="weight">
                <el-input
                  v-model="queryParams.weight"
                  placeholder="请输入体重"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="体脂" prop="bodyFat">
                <el-input
                  v-model="queryParams.bodyFat"
                  placeholder="请输入体脂"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <el-form-item label="原始成绩" prop="originalscore">
          <el-input
            v-model="queryParams.originalscore"
            placeholder="请输入原始成绩"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="性别" prop="gender">
          <el-select
            v-model="queryParams.gender"
            placeholder="请输入性别"
            clearable
            @keyup.enter.native="handleQuery"
          >
            <el-option label="男" value="男"></el-option>
            <el-option label="女" value="女"></el-option>

          </el-select>
        </el-form-item>

        <el-form-item label="班级" prop="classes">
          <el-input
            v-model="queryParams.classes"
            placeholder="请输入班级"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总评" prop="generalComments">
          <el-input
            v-model="queryParams.generalComments"
            placeholder="请输入总评"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!--      <el-form-item label="考核标准" prop="assessmentcriteria">
                <el-input
                  v-model="queryParams.assessmentcriteria"
                  placeholder="请输入考核标准"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>-->
        <!--      <el-form-item label="创建者" prop="createBy">
                <el-date-picker clearable
                                v-model="queryParams.createBy"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择创建者">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="创建时间" prop="createTime">
                <el-input
                  v-model="queryParams.createTime"
                  placeholder="请输入创建时间"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="更新者" prop="updateBy">
                <el-input
                  v-model="queryParams.updateBy"
                  placeholder="请输入更新者"
                  clearable
                  @keyup.enter.native="handleQuery"
                />
              </el-form-item>
              <el-form-item label="更新时间" prop="updateTime">
                <el-date-picker clearable
                                v-model="queryParams.updateTime"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择更新时间">
                </el-date-picker>
              </el-form-item>-->
        <br/>
        <div style="text-align:right;">

          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>

        </div>
        <br/>
      </el-form>

      <el-row :gutter="10" class="mb8">
        <!--      <el-col :span="1.5">
                <el-button
                  type="primary"
                  plain
                  icon="el-icon-plus"
                  size="mini"
                  @click="handleAdd"
                  v-hasPermi="['system:results:add']"
                >新增</el-button>
              </el-col>-->

        <el-col :span="1.5">
          <el-button
            type="danger"
            plain
            icon="el-icon-delete"
            size="mini"
            :disabled="multiple"
            @click="handleDelete"
            v-hasPermi="['yzx:xlcj:xlcj:remove']"
          >删除
          </el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="info"
            icon="el-icon-upload2"
            size="mini"
            @click="handleImport"
          >导入
          </el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
            v-hasPermi="['yzx:xlcj:xlcj:export']"
          >导出
          </el-button>
        </el-col>

        <!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
      </el-row>

      <el-table v-loading="loading" :data="resultsList" border @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center"/>
        <el-table-column type="index" label="序号" width="55" :index="indexMethod" align="center"/>
        <el-table-column label="姓名" align="center" prop="username"/>
        <!--      <el-table-column label="部职别" align="center" prop="departmentTitle" />
              <el-table-column label="出生日期" align="center" prop="birth" />-->
        <el-table-column label="性别" align="center" prop="gender"/>
        <!--      <el-table-column label="证件编号" align="center" prop="certificateId" />
              <el-table-column label="年龄" align="center" prop="age" />
              <el-table-column label="部门" align="center" prop="deptid" />-->
        <el-table-column label="身份证号" align="center" prop="idNumber"/>
        <!--      <el-table-column label="手机号1" align="center" prop="phoneOne" />
              <el-table-column label="手机号2" align="center" prop="phoneSecond" />
              <el-table-column label="籍贯" align="center" prop="nativePlace" />
              <el-table-column label="出生地" align="center" prop="birthplace" />
              <el-table-column label="民族" align="center" prop="nation" />
              <el-table-column label="最高学历" align="center" prop="highestEducation" />
              <el-table-column label="最高学位" align="center" prop="highestDegree" />
              <el-table-column label="毕业学校" align="center" prop="graduationSchool" />
              <el-table-column label="专业" align="center" prop="major" />
              <el-table-column label="人员类别" align="center" prop="personnelCategory" />
              <el-table-column label="政治面貌" align="center" prop="politics" />
              <el-table-column label="入党" align="center" prop="partyTime" width="180">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.partyTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column label="参加工作时间" align="center" prop="workingTime" width="180">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.workingTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column label="入伍时间" align="center" prop="militaryTime" width="180">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.militaryTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column label="教育培训经历" align="center" prop="educationTraining" />
              <el-table-column label="参加ZZ情况" align="center" prop="combatParticipation" />
              <el-table-column label="参加重大JS行动情况" align="center" prop="majorOperations" />
              <el-table-column label="奖惩情况" align="center" prop="reward" />
              <el-table-column label="简历" align="center" prop="resume" />
              <el-table-column label="JX" align="center" prop="baseRank" />
              <el-table-column label="用户ID" align="center" prop="userId" />
              <el-table-column label="部门ID" align="center" prop="deptId" />-->
        <el-table-column label="科目" align="center" prop="subject"/>
        <el-table-column label="班级" align="center" prop="classes"/>
        <!--      <el-table-column label="训练时间" align="center" prop="practiceTime" width="180">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.practiceTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>-->
        <!--      <el-table-column label="训练项目与内容" align="center" prop="trainingProgram" />-->
        <!--      <el-table-column label="身高" align="center" prop="height" />
              <el-table-column label="体重" align="center" prop="weight" />
              <el-table-column label="体脂" align="center" prop="bodyFat" />-->
        <!--      <el-table-column label="考核标准" align="center" prop="assessmentcriteria" />-->
        <el-table-column label="原始成绩" align="center" prop="originalscore"/>
        <!--      <el-table-column label="换算成绩" align="center" prop="conversionGrade" />-->
        <el-table-column label="总评" align="center" prop="generalComments"/>
        <!--      <el-table-column label="创建者" align="center" prop="createBy" width="180">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.createBy, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column label="创建时间" align="center" prop="createTime" />
              <el-table-column label="更新者" align="center" prop="updateBy" />
              <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
                </template>
              </el-table-column>
              <el-table-column label="备注" align="center" prop="remark" />
              <el-table-column label="备注1" align="center" prop="note1" />
              <el-table-column label="备注2" align="center" prop="note2" />
              <el-table-column label="备注3" align="center" prop="note3" />
              <el-table-column label="备注4" align="center" prop="note4" />
              <el-table-column label="备注5" align="center" prop="note5" />
              <el-table-column label="备注6" align="center" prop="note6" />
              <el-table-column label="备注7" align="center" prop="note7" />
              <el-table-column label="备注8" align="center" prop="note8" />
              <el-table-column label="备注9" align="center" prop="note9" />
              <el-table-column label="备注10" align="center" prop="note10" />-->
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"

              @click="handleUpdate(scope.row)"
              v-hasPermi="['yzx:xlcj:xlcj:edit']"
            >修改
            </el-button>
            <el-button
              size="mini"
              type="text"

              @click="handleDelete(scope.row)"
              v-hasPermi="['yzx:xlcj:xlcj:remove']"
            >删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport"/>
            是否更新已经存在的用户数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
                   @click="importTemplate"><span style="color: red">下载模板</span></el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 用户导入对话框 -->
    <!--    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
          <el-upload
            ref="upload"
            :limit="1"
            accept=".xlsx, .xls"
            :headers="upload.headers"
            :action="upload.url + '?updateSupport=' + upload.updateSupport"
            :disabled="upload.isUploading"
            :on-progress="handleFileUploadProgress"
            :on-success="handleFileSuccess"
            :auto-upload="false"
            drag
          >
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">
              将文件拖到此处，或
              <em>点击上传</em>
            </div>
            <div class="el-upload__tip" slot="tip">
              <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
              <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
            </div>
            <div class="el-upload__tip" style="color:red" slot="tip">提示：仅允许导入“xls”或“xlsx”格式文件！</div>
          </el-upload>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitFileForm">确 定</el-button>
            <el-button @click="upload.open = false">取 消</el-button>
          </div>
        </el-dialog>-->
    <!-- 添加或修改训练综合成绩评定对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-container>
          <el-main>
            <el-row>
              <el-col span="12">
                <el-form-item label="姓名" prop="username">
                  <el-input v-model="form.username" placeholder="请输入姓名"/>
                </el-form-item>
              </el-col>
              <!--        <el-form-item label="部职别" prop="departmentTitle">
                        <el-input v-model="form.departmentTitle" placeholder="请输入部职别" />
                      </el-form-item>
                      <el-form-item label="出生日期" prop="birth">
                        <el-input v-model="form.birth" placeholder="请输入出生日期" />
                      </el-form-item>-->
              <el-col span="12">
                <el-form-item label="性别" prop="gender">
                  <el-select
                    v-model="form.gender"
                    placeholder="请输入性别"
                    clearable
                    style="width: 100%"
                  >
                    <el-option label="男" value="男"></el-option>
                    <el-option label="女" value="女"></el-option>

                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <!--        <el-form-item label="证件编号" prop="certificateId">
                        <el-input v-model="form.certificateId" placeholder="请输入证件编号" />
                      </el-form-item>
                      <el-form-item label="年龄" prop="age">
                        <el-input v-model="form.age" placeholder="请输入年龄" />
                      </el-form-item>
                      <el-form-item label="部门" prop="deptid">
                        <el-input v-model="form.deptid" placeholder="请输入部门" />
                      </el-form-item>-->
              <el-col span="12">
                <el-form-item label="身份证号" prop="idNumber">
                  <el-input v-model="form.idNumber" placeholder="请输入身份证号"/>
                </el-form-item>
              </el-col>
              <!--        <el-form-item label="手机号1" prop="phoneOne">
                        <el-input v-model="form.phoneOne" placeholder="请输入手机号1" />
                      </el-form-item>
                      <el-form-item label="手机号2" prop="phoneSecond">
                        <el-input v-model="form.phoneSecond" placeholder="请输入手机号2" />
                      </el-form-item>
                      <el-form-item label="籍贯" prop="nativePlace">
                        <el-input v-model="form.nativePlace" placeholder="请输入籍贯" />
                      </el-form-item>
                      <el-form-item label="出生地" prop="birthplace">
                        <el-input v-model="form.birthplace" placeholder="请输入出生地" />
                      </el-form-item>
                      <el-form-item label="民族" prop="nation">
                        <el-input v-model="form.nation" placeholder="请输入民族" />
                      </el-form-item>
                      <el-form-item label="最高学历" prop="highestEducation">
                        <el-input v-model="form.highestEducation" placeholder="请输入最高学历" />
                      </el-form-item>
                      <el-form-item label="最高学位" prop="highestDegree">
                        <el-input v-model="form.highestDegree" placeholder="请输入最高学位" />
                      </el-form-item>
                      <el-form-item label="毕业学校" prop="graduationSchool">
                        <el-input v-model="form.graduationSchool" placeholder="请输入毕业学校" />
                      </el-form-item>
                      <el-form-item label="专业" prop="major">
                        <el-input v-model="form.major" placeholder="请输入专业" />
                      </el-form-item>
                      <el-form-item label="人员类别" prop="personnelCategory">
                        <el-input v-model="form.personnelCategory" placeholder="请输入人员类别" />
                      </el-form-item>
                      <el-form-item label="政治面貌" prop="politics">
                        <el-input v-model="form.politics" placeholder="请输入政治面貌" />
                      </el-form-item>
                      <el-form-item label="入党" prop="partyTime">
                        <el-date-picker clearable
                                        v-model="form.partyTime"
                                        type="date"
                                        value-format="yyyy-MM-dd"
                                        placeholder="请选择入党">
                        </el-date-picker>
                      </el-form-item>
                      <el-form-item label="参加工作时间" prop="workingTime">
                        <el-date-picker clearable
                                        v-model="form.workingTime"
                                        type="date"
                                        value-format="yyyy-MM-dd"
                                        placeholder="请选择参加工作时间">
                        </el-date-picker>
                      </el-form-item>
                      <el-form-item label="入伍时间" prop="militaryTime">
                        <el-date-picker clearable
                                        v-model="form.militaryTime"
                                        type="date"
                                        value-format="yyyy-MM-dd"
                                        placeholder="请选择入伍时间">
                        </el-date-picker>
                      </el-form-item>
                      <el-form-item label="教育培训经历" prop="educationTraining">
                        <el-input v-model="form.educationTraining" type="textarea" placeholder="请输入内容" />
                      </el-form-item>
                      <el-form-item label="参加ZZ情况" prop="combatParticipation">
                        <el-input v-model="form.combatParticipation" type="textarea" placeholder="请输入内容" />
                      </el-form-item>
                      <el-form-item label="参加重大JS行动情况" prop="majorOperations">
                        <el-input v-model="form.majorOperations" type="textarea" placeholder="请输入内容" />
                      </el-form-item>
                      <el-form-item label="奖惩情况" prop="reward">
                        <el-input v-model="form.reward" type="textarea" placeholder="请输入内容" />
                      </el-form-item>
                      <el-form-item label="简历" prop="resume">
                        <el-input v-model="form.resume" type="textarea" placeholder="请输入内容" />
                      </el-form-item>
                      <el-form-item label="JX" prop="baseRank">
                        <el-input v-model="form.baseRank" placeholder="请输入JX" />
                      </el-form-item>
                      <el-form-item label="用户ID" prop="userId">
                        <el-input v-model="form.userId" placeholder="请输入用户ID" />
                      </el-form-item>
                      <el-form-item label="部门ID" prop="deptId">
                        <el-input v-model="form.deptId" placeholder="请输入部门ID" />
                      </el-form-item>-->
              <el-col span="12">
                <el-form-item label="科目" prop="subject">
                  <el-input v-model="form.subject" placeholder="请输入科目"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col span="12">
                <el-form-item label="班级" prop="classes">
                  <el-input v-model="form.classes" placeholder="请输入班级"/>
                </el-form-item>
              </el-col>
              <!--        <el-form-item label="训练时间" prop="practiceTime">
                        <el-date-picker clearable
                                        v-model="form.practiceTime"
                                        type="date"
                                        value-format="yyyy-MM-dd"
                                        placeholder="请选择训练时间">
                        </el-date-picker>
                      </el-form-item>
                      <el-form-item label="训练项目与内容" prop="trainingProgram">
                        <el-input v-model="form.trainingProgram" type="textarea" placeholder="请输入内容" />
                      </el-form-item>
                      <el-form-item label="身高" prop="height">
                        <el-input v-model="form.height" placeholder="请输入身高" />
                      </el-form-item>
                      <el-form-item label="体重" prop="weight">
                        <el-input v-model="form.weight" placeholder="请输入体重" />
                      </el-form-item>
                      <el-form-item label="体脂" prop="bodyFat">
                        <el-input v-model="form.bodyFat" placeholder="请输入体脂" />
                      </el-form-item>-->
<!--              <el-col span="12">
                <el-form-item label="考核标准" prop="assessmentcriteria">
                  <el-input v-model="form.assessmentcriteria" placeholder="请输入考核标准"/>
                </el-form-item>
              </el-col>-->
              <el-col span="12">
              <el-form-item label="总评" prop="generalComments">
                <el-input v-model="form.generalComments" placeholder="请输入总评"/>
              </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col span="12">
                <el-form-item label="原始成绩" prop="originalscore">
                  <el-input v-model="form.originalscore" placeholder="请输入原始成绩"/>
                </el-form-item>
              </el-col>
<!--              <el-col span="12">
                <el-form-item label="换算成绩" prop="conversionGrade">
                  <el-input v-model="form.conversionGrade" placeholder="请输入换算成绩"/>
                </el-form-item>
              </el-col>-->
            </el-row>

            <!--        <el-form-item label="备注" prop="remark">
                      <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注1" prop="note1">
                      <el-input v-model="form.note1" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注2" prop="note2">
                      <el-input v-model="form.note2" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注3" prop="note3">
                      <el-input v-model="form.note3" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注4" prop="note4">
                      <el-input v-model="form.note4" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注5" prop="note5">
                      <el-input v-model="form.note5" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注6" prop="note6">
                      <el-input v-model="form.note6" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注7" prop="note7">
                      <el-input v-model="form.note7" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注8" prop="note8">
                      <el-input v-model="form.note8" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注9" prop="note9">
                      <el-input v-model="form.note9" type="textarea" placeholder="请输入内容" />
                    </el-form-item>
                    <el-form-item label="备注10" prop="note10">
                      <el-input v-model="form.note10" type="textarea" placeholder="请输入内容" />
                    </el-form-item>--> </el-main>
        </el-container>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {listResults, getResults, delResults, addResults, updateResults} from "@/api/module/yzx/xlcj/xlcj";
import {getToken} from "@/utils/auth";
import watermark from "watermark-dom";

export default {
  mounted() {
    watermark.load({watermark_txt: '  '});
  },
  name: "Results",
  data() {
    return {
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: {Authorization: "Bearer " + getToken()},
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/yzx/xlcj/xlcj/importData"
      },
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 训练综合成绩评定表格数据
      resultsList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        username: null,
        departmentTitle: null,
        birth: null,
        gender: null,
        certificateId: null,
        age: null,
        deptid: null,
        idNumber: null,
        phoneOne: null,
        phoneSecond: null,
        nativePlace: null,
        birthplace: null,
        nation: null,
        highestEducation: null,
        highestDegree: null,
        graduationSchool: null,
        major: null,
        personnelCategory: null,
        politics: null,
        partyTime: null,
        workingTime: null,
        militaryTime: null,
        educationTraining: null,
        combatParticipation: null,
        majorOperations: null,
        reward: null,
        resume: null,
        baseRank: null,
        userId: null,
        deptId: null,
        subject: null,
        classes: null,
        practiceTime: null,
        trainingProgram: null,
        height: null,
        weight: null,
        bodyFat: null,
        assessmentcriteria: null,
        originalscore: null,
        conversionGrade: null,
        generalComments: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      /* // 用户导入参数
       upload: {
         // 是否显示弹出层（用户导入）
         open: false,
         // 弹出层标题（用户导入）
         title: "",
         // 是否禁用上传
         isUploading: false,
         // 是否更新已经存在的用户数据
         updateSupport: 0,
         // 设置上传的请求头部project
         headers: { Authorization: "Bearer " + getToken() },
         // 上传的地址
         url: process.env.VUE_APP_BASE_API + "/yzx/xlcj/xlcj/importData"
       }*/
    };
  },
  created() {
    this.getList();
  },
  methods: {
    indexMethod(index) {
      index = (index + 1) + (this.queryParams.pageNum - 1) * this.queryParams.pageSize
      return index
    },
    /* importTemplate(){
     this.download('/yzx/xlcj/xlcj/importTemplate', {
     }, `user_template_${new Date().getTime()}.xlsx`)
      },

 // 取消按钮
   viewCancel() {
   this.view.open = false;
   },
     // 文件上传中处理
     handleFileUploadProgress(event, file, fileList) {
       this.upload.isUploading = true;
     },
     // 文件上传成功处理
     handleFileSuccess(response, file, fileList) {
       this.upload.open = false;
       this.upload.isUploading = false;
       this.$refs.upload.clearFiles();
       this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
       this.getList();
     },
     // 提交上传文件
     submitFileForm() {
       this.$refs.upload.submit();
     },*/
    /** 查询训练综合成绩评定列表 */
    getList() {
      this.loading = true;
      listResults(this.queryParams).then(response => {
        this.resultsList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        username: null,
        departmentTitle: null,
        birth: null,
        gender: null,
        certificateId: null,
        age: null,
        deptid: null,
        idNumber: null,
        phoneOne: null,
        phoneSecond: null,
        nativePlace: null,
        birthplace: null,
        nation: null,
        highestEducation: null,
        highestDegree: null,
        graduationSchool: null,
        major: null,
        personnelCategory: null,
        politics: null,
        partyTime: null,
        workingTime: null,
        militaryTime: null,
        educationTraining: null,
        combatParticipation: null,
        majorOperations: null,
        reward: null,
        resume: null,
        baseRank: null,
        userId: null,
        deptId: null,
        subject: null,
        classes: null,
        practiceTime: null,
        trainingProgram: null,
        height: null,
        weight: null,
        bodyFat: null,
        assessmentcriteria: null,
        originalscore: null,
        conversionGrade: null,
        generalComments: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加训练综合成绩评定";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getResults(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改训练综合成绩评定";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateResults(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addResults(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除训练综合成绩评定编号为"' + ids + '"的数据项？').then(function () {
        return delResults(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "导入";
      this.upload.open = true;
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('yzx/xlcj/xlcj/export', {
        ...this.queryParams
      }, `results_${new Date().getTime()}.xlsx`)
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('/yzx/xlcj/xlcj/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`)
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    }

  }
};
</script>
